import axios from 'axios';
import api from './api_address'
// 创建实例时配置默认值
export const http = axios.create({
    baseURL: 'https://apis.netstart.cn/mbcomic'
});

// 创建实例后修改默认值
// http.defaults.headers.common['Authorization'] = AUTH_TOKEN;
//添加响应拦截器
http.interceptors.response.use(function (response) {
    // 直接获取响应数据中的data
    return response.data;
}, function (error) {
    return Promise.reject(error);
});
// 代码可复用性
// 导出功能
// 搜索导航栏的接口
export const banner = (data = {}) => {
    // 返回promise实例
    return http.get(api.banner);
}
export const homeRecommend = (data = {}) => {
    return http.get(api.homeRecommend)
}
export const rank = (data = {}) => {
    return http.get(api.rankList, {
        params: data
    })
}
export const allLabel = (data = {}) => {
    return http.get(api.allLabel)
}
export const classPage = (data = {}) => {
    return http.get(api.classPage, {
        params: data
    })
}
export const comicDetail = (data = {}) => {
    return http.get(api.comicDetail, {
        params: data
    })
}
export const reply = (data = {}) => {
    return http.get(api.reply, {
        params: data
    })
}
export const about = (data = {}) => {
    return http.get(api.about, {
        params: data
    })
}

export const getImageIndex = (data = {}) => {
    return http.get(api.getImageIndex, {
        params: data
    })
}
export const imageToken = (data = {}) => {
    return http.get(api.imageToken, {
        params: data
    })
}